import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

public class Session implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    private Film film;
    private Screenroom screenroom; // 放映厅
    private LocalDateTime startTime;
    private boolean qA = false;
    private boolean[][] seat;
    private double currentMoney;
    private int ticketNum=0;
    private  int reTicket=0;
    public Session(Film film, Screenroom screenroom, LocalDateTime startTime){
        this.film = film;
        this.screenroom = screenroom;
        this.startTime = startTime;
        int i=0;
        if(Plan.isGoldTime(this.startTime)){
            i=10;
        }
        this.currentMoney = film.getMoney()+i;
        seat = new boolean[screenroom.getRow()+1][screenroom.getColumn()+1];
    }
    public String getFilm(){
        return this.film.getTitle();
    }
    public Film getFilms(){
        return this.film;
    }
    public void setFilm(Film film){
        this.film = film;
    }
    public Screenroom getScreen(){
        return this.screenroom;
    }
    public void setSeat(int row, int column,boolean bl) {
        this.seat[row][column] = bl;
    }
    public boolean getSeat(int row, int column) {
        return this.seat[row][column];
    }
    public String getStartTimes(){
        return this.startTime.toString();
    }
    public LocalDateTime getEndTime() {
        return startTime.plusMinutes(film.getDurationMinutes());
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }
    public void setQA(boolean qA) {
        this.qA = qA;
    }
    public boolean isqA() {
        return qA;
    }

    public double getCurrentMoney() {
        return currentMoney;
    }
    public void setTicketNum(int ticketNum,boolean bl) {
        if(bl){
            this.ticketNum+=ticketNum;
        }
        else{
            this.ticketNum--;
        }
    }

    public int getTicketNum() {
        return ticketNum;
    }
    public void setReTicket(){
        this.reTicket++;
    }
    public int getReTicket() {
        return reTicket;
    }

    public String getScreenRoom() {
        return this.screenroom.getRoomName();
    }
}
